using System.Collections.Generic;
using System.ComponentModel;

namespace FluentBinding.WinForms
{
    internal class PropertyNotifier
    {
        #region Fields

        private readonly IDictionary<string, string> _propertyNames = new Dictionary<string, string>();
        private bool _allProperties;

        #endregion

        #region Constructors

        public PropertyNotifier(INotifyPropertyChanged notifierEntity)
        {
            NotifierEntity = notifierEntity;
        }

        #endregion

        #region Public properties

        public INotifyPropertyChanged NotifierEntity { get; private set; }

        #endregion

        #region Public methods

        public bool IsRegistered(string propertyName)
        {
            return _allProperties ? true : _propertyNames.ContainsKey(propertyName);
        }

        public void RegisterAllProperties()
        {
            _allProperties = true;
        }

        public void RegisterPropertyName(string propertyName)
        {
            _propertyNames[propertyName] = propertyName;
        }

        #endregion
    }
}